import React from 'react';
import Product from '../../components/Product';
import { connect } from 'dva';

// class IndexPage extends React.Component {
//   render() {
//     const { productList, dispatch } = this.props;
//     return (
//       <div>
//         Product IndexPage
//         <Product title="商品类型" productList={productList} dispatch={dispatch}/>
//       </div>
//     )
//   }
// }

const ProductPage = ({productList, dispatch}) => {
  return (
    <div>
      Product IndexPage
      <Product title="商品类型" productList={productList} dispatch={dispatch}/>
    </div>
  )
}

const mapStateToProps = (state) => {
  return {
    productList: state.product.productList    //这里的product是models中的namespace
  }
}

export default connect(mapStateToProps)(ProductPage)
